package com.lry.crawlers.video.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.lry.crawlers.video.entity.VideoUpdate;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Update;

@Mapper
public interface VideoUpdateMapper extends BaseMapper<VideoUpdate> {

    @Update("update video_update set deleted=1 where DATE_SUB(CURDATE(), INTERVAL (select video_close_up_time from config) DAY) > date(update_time)")
    void updateTime();

    @Update("update video_update set chapter_num = chapter_num+1  where video_id=#{videoId}")
    int setVideoUpdateAddNum(@Param("videoId")String videoId);

    @Update("update video_update set chapter_num = chapter_num+#{num}  where video_id=#{videoId}")
    int setVideoUpdateAdd(@Param("videoId")String videoId,@Param("num")Integer num);
}
